package mybatis_spring.controller;

import lombok.AllArgsConstructor;
import mybatis_spring.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/hello")
@AllArgsConstructor
public class TestController {

    @Resource
    private final UserService userService;


    @GetMapping("/world1/{id}")
    public Object helloWorld1(@PathVariable Integer id) {
        return userService.selectOne(id);
    }

    @GetMapping("/world2/{id}")
    public Object helloWorld2(@PathVariable Integer id) {
        return userService.selectOne(id);
    }
}
